home *** CD-ROM | disk | FTP | other *** search
/ The Arcade BBS / arcadebbs.zip / arcadebbs / bbstools / WWIV Mods / WWIVMOD.ZIP / ELRIC31.MOD < prev    next >
Encoding:
Text File  |  1993-09-06  |  12.7 KB  |  397 lines

  1.                                 Elric 31
  2.                            New F1 User Editor.
  3.  
  4.  
  5. This procedure is just dropped into place on top of the current version of
  6. val_cur_user() in conio.c. It adds several fields to the editor...the fields
  7. now include name, real name, password, phone number, note, SL, DSL, AR, DAR,
  8. Exemptions (in a bit mapped format), sysop sub, # of posts and calls,
  9. # and total size of both uploads and downloads. Also, the current post to
  10. call ratio is displayed.
  11.  
  12. Another neat feature is that you can now edit anyone you choose.
  13. Use the up and down arrows to move around. If you place the cursor on
  14. top of the user number, then use the left and right arrows to scroll through
  15. the user list. Or, hit enter, and it will prompt you for a user number.
  16.  
  17.  
  18. Have fun.
  19. ---------------------------------------------------------------
  20. Good Lord, I made this back in 1989 or 1990, but as far
  21. as I remember I NEVER released it. In fact, I didn't even install it
  22. the past few versions.  But here it is, dusted off and updated
  23. for 4.20/4.21. If you are using something earlier, good luck.
  24.  
  25. Acutally, it won't be that much different, down at the bottom replace
  26. the line that says 
  27.  
  28.   reset_act_sl();
  29.  
  30. with this line 
  31.  
  32.   realsl=thisuser.sl;
  33.  
  34. However, I'm not real sure about that, maybe it's supposed to be
  35.  
  36.   actsl=thisuser.sl;
  37.  
  38. Could be both of them. <GRIN> Anyway, here's the mod.
  39.  
  40.  
  41. -----------------------------------------------------------------
  42. BUG FIX!! I released a version of this yesterday without the
  43. strip_space procedure. If that is not installed, anyone who gets 
  44. edited will not be able to log on again, because it will add spaces
  45. to the end of their password. Just install this version, compile, 
  46. run the BBS. Then just use the right arrow to scroll through the user
  47. list, and it will strip the spaces off all the passwords again.
  48.  
  49. Sorry for any inconvenience.
  50. -------------------------------------------------------------
  51.  
  52. /** this step is indeed a form step, much like a form letter **/
  53. 1. From DOS, in your dir where you keep your source....
  54.  
  55. PKZIP SOURCE *.c *.h
  56.  
  57. If you already have a source zip file, then
  58.  
  59. PKZIP -f source *.c *.h
  60.  
  61. This way you have a copy of everything before you screw it up with a bad mod.
  62. If you decide to take the mod out, it's as easy as
  63. PKUNZIP -x source
  64.  
  65. and hit Y to overwrite any files you changed.
  66.  
  67. /** we now resume our regularly scheduled mod with step 2.... **/
  68.  
  69.  
  70. 2. Load up conio.c. Delete the current copy of val_cur_user(), and replace it
  71. with this one.  Also, make sure you add the procedure strip_space right
  72. in front of val_cur_user().
  73.  
  74.  
  75. void strip_space(char *ss)
  76. {
  77. int i;
  78.  
  79. while (ss[strlen(ss)-1]==32)
  80.   ss[strlen(ss)-1]=0;
  81. }
  82.  
  83. void val_cur_user()
  84. /* val_cur_user allows the sysop at the keyboard to validate the current user,
  85.    chaning sl, dsl, ar, dar, sysop sub, exemptions, restrictions, and user
  86.    note
  87.  
  88.    Extreme modification by Lord Elric. This makes this officially Elric31.
  89.  
  90.    Now allows editing of name, real name, phone number, password, note,
  91.    number of calls, number of posts, number and size of uploads/downloads
  92.  
  93.    Use the up and down arrows to move between fields. Place the cursor on
  94.    the user number, and either use the left and right arrows to roll the users
  95.    around, or hit enter and enter a user number. Either way, it allows
  96.    you to edit anyone, no matter who is on line. Always drops back to the
  97.    current user upon exit. It's as debugged as it's gonna get.
  98.  
  99.    One last note, the Exemptions are now displayed and edited in a bitmapped
  100.    format. The only one that has any effect at all is bit 0, but you can code
  101.    others in if you want to. I did.
  102.  
  103.  */
  104. {
  105.  
  106. char sl[4],dsl[4],exempt[17],sysopsub[4],ar[17],dar[17],restrict[17],rst[17],
  107.        tl[50],dk[34],uk[34],ndl[33],nul[33],pr[5],cr[5],usern[6],gold[11];
  108.   int cp,i,done,rc,wx,wy;
  109.   double ratio;
  110.   unsigned int unum,oldn;
  111.   userrec un;
  112.   int ch,ch2;
  113.  
  114.   #define MAXEDITBOXES 18
  115.  
  116.   pr_wait(1);
  117.   savescreen(&screensave);
  118.   curatr=14;
  119.   wx=15;
  120.   wy=4;
  121.   unum=usernum;                  /** unum points to the current "editee" **/
  122.   oldn=0;       /** oldnum points to previous unum, nuke it for now **/
  123.   write_user(usernum,&thisuser); /** write the old record out **/
  124.   read_user(unum,&un);           /** read it back in, in un **/
  125.   done=0;
  126.   cp=0;
  127.  
  128.   makewindow(wx,wy,50,17);   /** make the box on the screen */
  129.  
  130.   while (done==0) {
  131.   if (oldn!=unum) {
  132.   itoa((int)un.sl,sl,10);
  133.   itoa((int)unum,usern,10);
  134.   itoa((int)un.dsl,dsl,10);
  135.   itoa((int)un.sysopsub,sysopsub,10);
  136.   ultoa(un.dk,dk,10);
  137.   ultoa(un.uk,uk,10);
  138.   itoa((int)un.downloaded,ndl,10);
  139.   itoa((int)un.uploaded,nul,10);
  140.   itoa((int)un.msgpost,pr,10);
  141.   itoa((int)un.logons,cr,10);
  142.   ltoa((long)un.gold,gold,10);
  143.   strcpy(rst,restrict_string);
  144.   for (i=0; i<=15; i++) {
  145.     if (un.ar & (1 << i))
  146.       ar[i]='A'+i;
  147.     else
  148.       ar[i]=32;
  149.     if (un.dar & (1 << i))
  150.       dar[i]='A'+i;
  151.     else
  152.       dar[i]=32;
  153.     if (un.restrict & (1 << i))
  154.       restrict[i]=rst[i];
  155.     else
  156.       restrict[i]=32;
  157.   }
  158.   for (i=0; i<=7; i++) {
  159.     if (un.exempt & (1<<i))
  160.       exempt[7-i]='0'+i;
  161.     else
  162.       exempt[7-i]=32;
  163.   }
  164.   exempt[8]=0;
  165.   dar[16]=0;
  166.   ar[16]=0;
  167.   restrict[16]=0;
  168.  
  169.  
  170.   movecsr(wx+2,wy+1);   sprintf(tl,"NAME %-30s",un.name);        outs(tl);
  171.   movecsr(wx+39,wy+1);  sprintf(tl,"USER# %-4s",usern);          outs(tl);
  172.   movecsr(wx+2,wy+2);   sprintf(tl,"RN   %-20s",un.realname);    outs(tl);
  173.   movecsr(wx+2,wy+3);   sprintf(tl,"PHONE %-12s",un.phone);      outs(tl);
  174.   movecsr(wx+22,wy+3);  sprintf(tl,"PW %-8s",un.pw);             outs(tl);
  175.   movecsr(wx+2,wy+5);   sprintf(tl,"NOTE %-40s",un.note);        outs(tl);
  176.   movecsr(wx+2,wy+7);   sprintf(tl,"SL   %-3s",sl);              outs(tl);
  177.   movecsr(wx+13,wy+7);  sprintf(tl,"AR  %-s",ar);                outs(tl);
  178.   movecsr(wx+34,wy+7);  sprintf(tl,"EXMPT %-s",exempt);          outs(tl);
  179.   movecsr(wx+2,wy+8);  sprintf(tl,"DSL  %-3s",dsl);             outs(tl);
  180.   movecsr(wx+13,wy+8); sprintf(tl,"DAR %-s",dar);               outs(tl);
  181.   movecsr(wx+34,wy+8); sprintf(tl,"SYSOP SUB %-3s",sysopsub);   outs(tl);
  182.   movecsr(wx+8,wy+9);  sprintf(tl,"RESTRICT %-s",restrict);     outs(tl);
  183.   movecsr(wx+2,wy+11);  sprintf(tl,"#UL %-4s",nul);              outs(tl);
  184.   movecsr(wx+13,wy+11); sprintf(tl,"UL KB %-9s",uk);             outs(tl);
  185.   movecsr(wx+2,wy+12); sprintf(tl,"#DL %-4s",ndl);              outs(tl);
  186.   movecsr(wx+13,wy+12); sprintf(tl,"DL KB %-9s",dk);             outs(tl);
  187.   movecsr(wx+2,wy+13);  sprintf(tl,"#POSTS %-4s",pr);            outs(tl);
  188.   movecsr(wx+15,wy+13); sprintf(tl,"#CALLS %-4s",cr);            outs(tl);
  189.   movecsr(wx+2,wy+14);  sprintf(tl,"GOLD  %-6s",gold);           outs(tl);
  190.   oldn=unum;
  191.   }                                          
  192.  
  193.   ratio=0;
  194.   if (un.logons>0)
  195.     ratio=(float) un.msgpost / (float) un.logons;
  196.   if (ratio>99.99)
  197.     ratio=99.99;
  198.   movecsr(wx+28,wy+13); sprintf(tl,"P/C  %-6.3lf",ratio); outs(tl);
  199.     switch(cp) {
  200.       case 0:
  201.         movecsr(wx+45,wy+1);
  202.         ch=getch();
  203.          switch (ch) {
  204.            case 0:
  205.               ch2=getch();
  206.               rc=0;
  207.                 switch (ch2){
  208.                   case 75:
  209.                     unum-=1;
  210.                     if (unum==0)
  211.                        unum=status.users;
  212.                     break;
  213.                   case 77:
  214.                      unum+=1;
  215.                      if (unum>status.users)
  216.                        unum=1;
  217.                        break;
  218.                    case 72:
  219.                      rc=PREV;
  220.                      break;
  221.                    case 80:
  222.                      rc=NEXT;
  223.                      break;
  224.                    case 59:
  225.                      rc=DONE;
  226.                      break;
  227.                 }
  228.               break;
  229.            case 13:
  230.              editline(usern,4,NUM_ONLY,&rc,"");
  231.              unum=atoi(usern);
  232.              if (unum>status.users)
  233.                unum=status.users;
  234.              itoa((int)unum,usern,10);
  235.              sprintf(tl,"%-4s",usern); outs(tl);
  236.  
  237.              rc=0;
  238.            break;
  239.         }
  240.         if (unum!=oldn){
  241.           strip_space(un.pw);
  242.           strip_space(un.note);
  243.           write_user(oldn,&un);
  244.           read_user(unum,&un);
  245.           }
  246.         break;
  247.       case 1:
  248.         movecsr(wx+7,wy+2);
  249.         editline(un.realname,20,ALL,&rc,"");
  250.         break;
  251.       case 2:
  252.         movecsr(wx+8,wy+3);
  253.         editline(un.phone,12,ALL,&rc,"");
  254.         break;
  255.       case 3:
  256.         movecsr(wx+25,wy+3);
  257.         editline(un.pw,8,ALL,&rc,"");
  258.         break;
  259.       case 4:
  260.         movecsr(wx+7,wy+5);
  261.         editline(un.note,40,ALL,&rc,"");
  262.         break;
  263.       case 5:
  264.         movecsr(wx+7,wy+7);
  265.         editline(sl,3,NUM_ONLY,&rc,"");
  266.         un.sl=(char) atoi(sl);
  267.         itoa((int)un.sl,sl,10);
  268.         sprintf(tl,"%-3s",sl); outs(tl);
  269.         break;
  270.       case 6:
  271.         movecsr(wx+17,wy+7);
  272.         editline(ar,16,SET,&rc,"ABCDEFGHIJKLMNOP");
  273.         un.ar=0;
  274.         for (i=0; i<=15; i++)
  275.           if (ar[i]!=32)
  276.             un.ar |= (1 << i);
  277.         break;
  278.       case 7:
  279.         movecsr(wx+40,wy+7);
  280.         editline(exempt,8,SET,&rc,"76543210");
  281.         un.exempt=0;
  282.         for (i=0; i<=7; i++)
  283.           if (exempt[i]!=32)
  284.             un.exempt |= (0xF0 >> i);
  285.         break;
  286.       case 8:
  287.         movecsr(wx+7,wy+8);
  288.         editline(dsl,3,NUM_ONLY,&rc,"");
  289.         un.dsl=(char) atoi(dsl);
  290.         itoa((int)un.dsl,dsl,10);
  291.         sprintf(tl,"%-3s",dsl); outs(tl);
  292.         break;
  293.       case 9:
  294.         movecsr(wx+17,wy+8);
  295.         editline(dar,16,SET,&rc,"ABCDEFGHIJKLMNOP");
  296.         un.dar=0;
  297.         for (i=0; i<=15; i++)
  298.           if (dar[i]!=32)
  299.             un.dar |= (1 << i);
  300.         break;
  301.       case 10:
  302.         movecsr(wx+44,wy+8);
  303.         editline(sysopsub,3,NUM_ONLY,&rc,"");
  304.         un.sysopsub=(char) atoi(sysopsub);
  305.         itoa((int)un.sysopsub,sysopsub,10);
  306.         sprintf(tl,"%-3s",sysopsub); outs(tl);
  307.         break;
  308.       case 11:
  309.         movecsr(wx+17,wy+9);
  310.         editline(restrict,16,SET,&rc,rst);
  311.         un.restrict=0;
  312.         for (i=0; i<=15; i++)
  313.           if (restrict[i]!=32)
  314.             un.restrict |= (1 << i);
  315.         break;
  316.       case 12:
  317.         movecsr(wx+6,wy+11);
  318.         editline(nul,4,NUM_ONLY,&rc,"");
  319.         un.uploaded=(int) atoi(nul);
  320.         itoa((int)un.uploaded,nul,10);
  321.         sprintf(tl,"%-4s",nul); outs(tl);
  322.         break;
  323.       case 13:
  324.         movecsr(wx+19,wy+11);
  325.         editline(uk,9,NUM_ONLY,&rc,"");
  326.         un.uk= atol(uk);
  327.         ultoa(un.uk,uk,10);
  328.         sprintf(tl,"%-9s",uk); outs(tl);
  329.         break;
  330.       case 14:
  331.         movecsr(wx+6,wy+12);
  332.         editline(ndl,4,NUM_ONLY,&rc,"");
  333.         un.downloaded=(int) atoi(ndl);
  334.         itoa((int)un.downloaded,ndl,10);
  335.         sprintf(tl,"%-4s",ndl); outs(tl);
  336.         break;
  337.       case 15:
  338.         movecsr(wx+19,wy+12);
  339.         editline(dk,9,NUM_ONLY,&rc,"");
  340.         un.dk= atol(dk);
  341.         itoa(un.dk,dk,10);
  342.         sprintf(tl,"%-9s",dk); outs(tl);
  343.         break;
  344.       case 16:
  345.         movecsr(wx+9,wy+13);
  346.         editline(pr,4,NUM_ONLY,&rc,"");
  347.         un.msgpost=(int) atoi(pr);
  348.         itoa(un.msgpost,pr,10);
  349.         sprintf(tl,"%-4s",pr); outs(tl);
  350.         break;
  351.       case 17:
  352.         movecsr(wx+22,wy+13);
  353.         editline(cr,4,NUM_ONLY,&rc,"");
  354.         un.logons=(int) atoi(cr);
  355.         itoa(un.logons,cr,10);
  356.         sprintf(tl,"%-4s",cr); outs(tl);
  357.         break;
  358.       case 18:
  359.         movecsr(wx+7,wy+14);
  360.         editline(gold,6,NUM_ONLY,&rc,"");
  361.         un.gold=(float) atoi(gold);
  362.         itoa(un.gold,gold,10);
  363.         sprintf(tl,"%-6s",gold); outs(tl);
  364.         break;
  365.     }
  366.     switch(rc) {
  367.       case DONE: done=1; break;
  368.       case NEXT: cp=(cp+1) % (MAXEDITBOXES +1); break;
  369.       case PREV: cp=(cp+MAXEDITBOXES) % (MAXEDITBOXES +1); break;
  370.     }
  371.   }
  372.   restorescreen(&screensave);
  373.   strip_space(un.pw);                  /** added for new version **/
  374.   strip_space(un.note);                /** added for new version **/
  375.   write_user(unum,&un);           /** write out whoever it was we were 
  376. editing. **/
  377.   read_user(usernum,&thisuser);   /** read in the guy online **/
  378.   close_user();                   /** close the user file **/
  379.   reset_act_sl();
  380.   changedsl();
  381.   pr_wait(0);
  382. }
  383.  
  384.  
  385. /** hey, it's the form info file **/
  386. As usual, I take no responsibility for hard drive crashes, death in the
  387. family, or end of the world as we know it resulting from this mod.
  388. It's your fault if you didn't back up the files before you made the mod.
  389. It's your fault if you don't back up your ENTIRE hard drive AT LEAST once
  390. a month.
  391. It works on my system with Turbo C++, WWIV 4.2.
  392.  
  393. Lord Elric
  394. 1@18270
  395. 4@18251
  396.  
  397.